<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="js/jquery-3.3.1.min.js"></script>
</head>
<body>
<button>点我</button>

<script>
    $("button").on('click', function () {
        $.ajax({
            url: "/user/reg",
            type:"post",
            data: JSON.stringify({
                "username": "taojinhui",
                "password": "123456"
            }),
            success: function (resp) {
                console.log(resp)
            },
            contentType:"application/json"
        });
    });
</script>
</body>
</html>